import request from '@/router/axios';

export const getRoleList = () => {
  return request({
    url: '/api/blade-system/role/list',
    method: 'get',

  })
}
export const remove = (ids) => {
  return request({
    url: '/api/blade-system/role/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/blade-system/role/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/blade-system/role/submit',
    method: 'post',
    data: row
  })
}

export const getRole = (id) => {
  return request({
    url: '/api/blade-system/role/detail',
    method: 'get',
    params: {
      id
    }
  })
}


export const getMenuTree = () => {
  return request({
    url: 'api/blade-system/menu/tree',
    method: 'get'
  })
}


export const getRoleTree = (roleIds) => {
  return request({
    url: 'api/blade-system/menu/role-tree-keys',
    method: 'get',
    params: {
      roleIds,
    }
  })
}

// 修改角色勾选
export const updateRole = (menuIds, roleIds) => {
  // debugger;
  return request({
    url: '/api/blade-system/role/grant',
    method: 'post',
    params: {
      menuIds,
      roleIds
    }
  })
}
